package com.cmti.skeleton.dao.mapper;

import org.apache.ibatis.jdbc.SQL;

import com.cmti.skeleton.entity.SysDept;

public class SysDeptSqlProvider {

    public String insertSelective(SysDept record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("sys_dept");
        
        if (record.getName() != null) {
            sql.VALUES("NAME", "#{name,jdbcType=VARCHAR}");
        }
        
        if (record.getPId() != null) {
            sql.VALUES("P_ID", "#{pId,jdbcType=BIGINT}");
        }
        
        if (record.getRemark() != null) {
            sql.VALUES("REMARK", "#{remark,jdbcType=VARCHAR}");
        }
        
        if (record.getStatus() != null) {
            sql.VALUES("STATUS", "#{status,jdbcType=INTEGER}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(SysDept record) {
        SQL sql = new SQL();
        sql.UPDATE("sys_dept");
        
        if (record.getName() != null) {
            sql.SET("NAME = #{name,jdbcType=VARCHAR}");
        }
        
        if (record.getPId() != null) {
            sql.SET("P_ID = #{pId,jdbcType=BIGINT}");
        }
        
        if (record.getRemark() != null) {
            sql.SET("REMARK = #{remark,jdbcType=VARCHAR}");
        }
        
        if (record.getStatus() != null) {
            sql.SET("STATUS = #{status,jdbcType=INTEGER}");
        }
        
        sql.WHERE("ID = #{id,jdbcType=BIGINT}");
        
        return sql.toString();
    }
}